package com.cy.pj.arithmetic.controller;

import com.cy.pj.common.pojo.ResponseResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ArithmeticController {

    @ResponseBody
    @RequestMapping("/doCompute/{n1}/{n2}")
    public ResponseResult doCompute(@PathVariable Integer n1, @PathVariable Integer n2){
        int result = n1 / n2;
        return new ResponseResult(result);//返回对象时, 都是通过json的方式来呈现在客户端中
    }

}
